package com.nancy.ioc.BeanPostProcessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.core.Ordered;
import org.springframework.lang.Nullable;

/**
 * @Author: cc.zong
 * @Description:
 * @Date: created in 下午1:09 2019/1/11
 */
public class LogicBeanPostProcessorOrderd_1 implements BeanPostProcessor, Ordered {

    public LogicBeanPostProcessorOrderd_1(){
        System.out.println("LogicBeanPostPrLogicBeanPostProcessorOrderd_1ocessorOrderd_0 被 beanFactory.getBean() 提前初始化");
    }

    @Nullable
    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("LogicBeanPostProcessorOrderd_1.postProcessAfterInitialization 执行啦  beanName = " + beanName);
        return bean;
    }

    @Nullable
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("LogicBeanPostProcessorOrderd_1.postProcessBeforeInitialization 执行啦  beanName = " + beanName);
        return bean;
    }

    @Override
    public int getOrder() {
        return 1;
    }
}
